package Bean;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BookService {
    // 模拟内存中数据库
    static Map<Integer , List<Book>> bookDb = new HashMap<Integer , List<Book>>();
    static {
        // 初始化bookDb对象
        List<Book> list1 = new ArrayList<Book>();
        List<Book> list2 = new ArrayList<Book>();
        List<Book> list3 = new ArrayList<Book>();
        list1.add(new Book(1 , "话语输出" , "fsavg" , 109));
        list1.add(new Book(2 , "eyegr" , "cwecg" , 99));
        list1.add(new Book(3 , "srgg" , "qqqqqqqqqeee" , 89));
        list2.add(new Book(4 , "ggggg" , "rrrreee" , 23));
        list2.add(new Book(5 , "hhhhhhh" , "rrrrr" , 20));
        list3.add(new Book(6 , "ttttttt" , "gggggg" , 16));
        list3.add(new Book(7 , "aaaaaa" , "ggggg" , 18));
        bookDb.put(1 , list1);
        bookDb.put(2 , list2);
        bookDb.put(3 , list3);
    }
    public List<Book> getBookByCategory(int categoryId) {
        return bookDb.get(categoryId);
    }
}